/***************************************************************************
 *   Copyright (C) 2009 by Marcin Swiechowicz   *
 *   marcin.swiechowicz@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef KDCMAINWINDOWFRAME_H
#define KDCMAINWINDOWFRAME_H

#include <interfaces/kdcplugininterface.h>
#include <kdcnamespace.h>
#include <kdcdisc.h>

#include <QWidget>
#include <QSplitter>
#include <QStackedWidget>
#include <QButtonGroup>
#include <QMap>
#include <QVBoxLayout>
#include <QHBoxLayout>

#include <KMultiTabBar>
#include <KMultiTabBarTab>
#include <KTabWidget>

class KDCMainWindowFrame;

class KDCMainWindowFramePrivate : public QObject
{
Q_OBJECT
public:
	KDCMainWindowFramePrivate( KDCMainWindowFrame *aParent, KDC::Position position );
	~KDCMainWindowFramePrivate();
	KDC::Position position() const;
	void addGuiWidget( QWidget *aWidget, const QString &aName, const KIcon &aIcon );
	void removeGuiWidget( QWidget *aWidget );
	QWidget* widget() const;
	int count() const;
	KMultiTabBar* tabBars() const;
public slots:
	void hide();
	void show();
private slots:
	void slotButtonClicked( int );
private:
	KDC::Position p_position;
	QStackedWidget *p_stack;
	KMultiTabBar *p_tabBars;
	QButtonGroup *p_buttons;
	KTabWidget *p_tabWidget;
	int p_id;
};

class KDCMainWindowFrame : public QWidget
{
Q_OBJECT
public:
	KDCMainWindowFrame( QWidget *parent = 0 );
	~KDCMainWindowFrame();
	void addPlugin( KDCPluginInterface *interface );
	void removePlugin( KDCPluginInterface *interface );
	void setupGui();
protected:
	void cleanStack( KDC::Position pos );
private:
	QList<KDCMainWindowFramePrivate*> p_tabBars;
};
#endif
